<include file="/public/header" />
<!-- 重定位style -->
<style>
.layui-table-cell {height: 35px;line-height: 35px;}
.layui-table, .layui-table-view{margin-top: 0px;}
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
        <div class="layui-form">
            <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="">{:__('按状态查询')}</option>
                        <option value="2" >{:__('正常')}</option>                                 
                        <option value="1" >{:__('关闭')}</option>             
                    </select>
                </div>  
            </div>
                
            <div class="layui-inline">
                <div class="layui-form-label">{:__('栏目名称')}</div>
                <div class="layui-input-inline "><input name="title" class="layui-input" type="text" placeholder="{:__('栏目名称')}"/></div>
            </div>

            <div class="layui-inline">
                <div class="layui-form-label">{:__('模型名称')}</div>
                <div class="layui-input-inline "><input name="model" class="layui-input" type="text" placeholder="{:__('模型名称')}"/></div>
            </div>
            <div class="layui-inline" >
                <!-- // 默认搜索 -->
                <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit>
                    <i class="layui-icon layui-icon-search"></i>{:__('搜索')}
                </button>

                <!-- // 打开添加页面 -->
                <button class="layui-btn icon-btn" lay-open="" data-area="100%,100%" data-offset="0px" data-maxmin="true" data-url="{:url('/system.category/add')}" >
                    <i class="layui-icon layui-icon-add-1"></i>{:__('添加')}
                </button>
            </div>
            </div>
        </div> 

        </div>

        <!-- // 创建数据表实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>        
    </div>
</div>

<!-- // 列表状态栏 -->
<script type="text/html" id="columnStatus">
    <input type="checkbox" lay-filter="switchStatus" data-url="{:url('/system.category/status')}" value="{{d.id}}" 
    lay-skin="switch" {{d.status==1?'checked':''}}  />
</script>
 
<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar"> 
    <a class="layui-table-text" data-area="100%,100%" data-offset="0px" data-maxmin="true"
        data-url="{:url('/system.category/edit')}?id={{d.id}}" lay-event="edit" >{:__('编辑')}</a>
    <div class="layui-divider layui-divider-vertical"></div>
    <a class="layui-table-text"  data-url="{:url('/system.category/del')}?id={{d.id}}" lay-event="del" >{:__('删除')}</a>
</script>
<include file="/public/footer" />
<script>
    layui.use(function () {

        var table = layui.table;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            ,url: "{:url('/system.category/index')}"
            ,cols: [[
                {type: 'checkbox', width:45},
                {field: 'id', align: 'center',sort: true,width: 80,  title: 'ID'},
                {field: 'title', align: 'left',templet:function(d){
                    var left = d._level * 32;
                    var html = '<div style="padding-left:'+ left + 'px;">';
                        html += '<a href="'+d.readurl+'" target="_blank" >';
                        if (d._level >= 1) {
                            html += '|-';
                        }
                        html += d.title + '</a>';
                        html += ' </div>';
                    return html
                }, title: '{:__("名称")}'},
                {field: 'channel', align: 'center',width:180,title: '{:__("模型")}'},
                {field: 'sort', sort: true,align: 'center',width:180,  title: '{:__("排序")}'},
                {field: 'status', align: 'center',width:180, templet: '#columnStatus', title: '{:__("状态")}'},
                {field: 'pinyin', align: 'center',width:180, title: '{:__("英文名")}'},
                {field: 'skin', align: 'center', width:180, title: '{:__("分类页")}'},
                {align: 'center', toolbar: '#tableBar', width:150, title: '{:__("操作")}'},
            ]]
        })
    })
</script>
